package com.bizfx.component.views
{
	import flash.events.EventDispatcher;

	import com.bizfx.component.FieldDataType;
	import com.bizfx.utils.StringUtils;

	[Bindable]
	public class ListViewColumn extends EventDispatcher
	{
		/**
		 * 列标识
		 */
		private var _key:String;
		
		public function get key(): String
		{
			return _key;
		}
		
		public function set key(value: String):void
		{
			_key = value;
		}
		
		/**
		 * 列名称
		 */
		private var _text:String;
		
		public function get text(): String
		{
			return _text;
		}
		
		public function set text(value: String):void
		{
			_text = value;
		}
		
		/**
		 * 列字段
		 */
		private var _dataField:String = "";
		
		public function get dataField(): String
		{
			return _dataField;
		}
		
		public function set dataField(value: String):void
		{
			_dataField = value;
		}
		
		/**
		 * 列宽度
		 */
		private var _width:int;
		
		public function get width():int
		{
			return _width;
		}
		
		public function set width(value:int):void
		{
			_width = value;
		}		
		
		/**
		 * 列格式化
		 */
		private var _formatString:String;
		
		public function get formatString():String
		{
			return _formatString;
		}
		
		public function set formatString(value:String):void
		{
			_formatString = value;
		}
		
		/**
		 * 数据类型
		 */
		private var _dataType:String = FieldDataType.STRING;
		
		public function get dataType():String
		{
			return _dataType;
		}
		
		public function set dataType(value:String):void
		{
			_dataType = value;
		}
		
		private var _visible:Boolean;
		
		public function get visible():Boolean
		{
			return _visible;
		}
		
		public function set visible(value:Boolean):void
		{
			_visible = value;
		}
		
		private var _serverSideSort:Boolean = true;
		
		public function get serverSideSort():Boolean
		{
			return _serverSideSort;
		}
		
		public function set serverSideSort(value:Boolean):void
		{
			_serverSideSort = value;
		}
		
		private var _serverSideSortField:String;
		
		public function get serverSideSortField():String
		{
			if (StringUtils.isNullOrEmpty(this._serverSideSortField)) {
				return this._dataField;
			}
			return _serverSideSortField;
		}
		
		public function set serverSideSortField(value:String):void
		{
			_serverSideSortField = value;
		}
		
		private var _labelFunction:Function;

		public function get labelFunction():Function
		{
			return _labelFunction;
		}

		public function set labelFunction(value:Function):void
		{
			_labelFunction = value;
		}
		
		public function ListViewColumn()
		{
		}
	}
}